# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>

pkgname=php82-pecl-uploadprogress
_extname=uploadprogress
pkgver=2.0.2
pkgrel=0
pkgdesc="PHP 8.2 extension to track progress of a file upload - PECL"
url="https://pecl.php.net/package/uploadprogress"
arch="all"
license="PHP-3.01"
depends="php82-common"
makedepends="php82-dev"
subpackages="$pkgname-doc::noarch"
source="php-pecl-$_extname-$pkgver.tar.gz::https://pecl.php.net/get/uploadprogress-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize82
	./configure --prefix=/usr --with-php-config=php-config82
	make
}

check() {
	php82 -d extension=modules/$_extname.so --ri $_extname
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS='--show-diff '
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	local confdir="$pkgdir/etc/php82/conf.d"
	mkdir -p "$confdir"
	echo "extension=$_extname" > "$confdir"/$_extname.ini

	local docdir="$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 -t $docdir README.md
	cp -r examples/. $docdir/examples
}

sha512sums="
b9ee5a09c3de78d58abd34da2d25d7b0cad38416309a9a69192f07e0c3fe2259de261bb3dee571e64e042753f861738ebcd67fa7fafeb595ec32ed3034c773cd  php-pecl-uploadprogress-2.0.2.tar.gz
"
